﻿<%@ WebHandler Language="C#" Class="SIPO.Web.AjaxHandler.Loaddata.getDemand" %>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using SIPO.Library.DataAccess.Transaction;
using SIPO.Library.DomainObject.Transaction;
using SIPO.Library.Enum;
using System.Text;
using SIPO.Web.Support;
using Newtonsoft.Json.Linq;

namespace SIPO.Web.AjaxHandler.Loaddata
{
    public class getDemand : SIPO.Web.BaseHandler
    {
        recDemandRepo demandDal = new recDemandRepo(ConfigurationManager.ConnectionStrings["SIPOConn"].ConnectionString);
        
        string MethodName = string.Empty;
        
        public override void ProcessRequest(HttpContext context)
        {
            base.ProcessRequest(context);

            if (context.Request.Params["method"] != null)
                MethodName = context.Request.Params["method"];

            
            if(MethodName.Equals("getPelimpahan"))
            {
                int demandNo = int.Parse(context.Request.Params["DemandNo"].ToString());
                int jml = demandDal.GetPelimpahan(demandNo);

                StringBuilder sbProject = new StringBuilder();

                sbProject.Append("{");
                sbProject.AppendFormat("  {0}Jumlah{0}:{0}{1}{0}", "\"", jml);
                sbProject.Append("}");

                context.Response.Write(sbProject.ToString());
            }
        }

        public override bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}